package com.java2007.hotel.dao;

import com.java2007.hotel.entity.PageBean;
import com.java2007.hotel.pojo.Food;

import java.sql.SQLException;
import java.util.List;

/**
 * @author Reckeys
 * @version V1.0
 * @date 2021/01/23
 **/
public interface FoodDao {
    /**
     * 通过菜名模糊查询
     * @param foodName
     * @return
     */
    List<Food> findByFoodName(String foodName) throws SQLException;

    /**
     * 通过foodId删除
     * @param foodId
     * @return
     * @throws SQLException
     */
    int deleteByFoodId(Integer foodId) throws SQLException;

    /**
     * 通过foodId查询
     * @param foodId
     * @return
     */
    Food findByfoodId(Integer foodId) throws SQLException;

    /**
     * 添加菜
     * @param food
     */
    int addFood(Food food) throws SQLException;

    /**
     * 修改菜信息
     * @param food
     * @return
     */
    int updateFood(Food food) throws SQLException;

    /**
     * 分页查询
     * @param sql
     * @return
     * @throws SQLException
     */
    List<Food> findFoodToPage(String sql,List<Object> params) throws SQLException;


    /**
     * 查询总数量
     * @param sql
     * @param params
     * @return
     */
    Long findCount(String sql, List<Object> params ) throws SQLException;

    /**
     * 按名字查询
     * @param foodName
     * @return
     */
    Food findFood(String foodName) throws SQLException;
}
